﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="contacts.aspx.cs" Inherits="CANO.WebSite.contacts.ContactsList" %>

<%@ Register Assembly="Ext.Net" Namespace="Ext.Net" TagPrefix="ext" %>
<%@ Register TagPrefix="uc" TagName="Header" Src="~/UserControls/ucHeader.ascx" %>
<%@ Register TagPrefix="uc" TagName="NavigationMenu" Src="~/UserControls/ucNavigationMenu.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="cs" xml:lang="cs" xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
	<meta content="text/html; charset=utf-8" http-equiv="content-type">
	<meta content="text/css" http-equiv="content-style-type">
	<meta content="text/javascript" http-equiv="content-script-type">
	<title>CANOPropiedades</title>
	<link media="screen, projection, tv" href="../css/blue.css" type="text/css" rel="stylesheet">
	<script src="../js/jquery-1.8.2.js" type="text/javascript"></script>
	<style type="text/css">
		.x-grid3-td-fullName .x-grid3-cell-inner
		{
			font-family: tahoma, verdana;
			display: block;
			font-weight: normal;
			font-style: normal;
			color: #385F95;
			white-space: normal;
			font-weight:bold;
		}
		.x-grid3-cell-inner
		{
			font-size:15px;
		}
		.x-grid3-row-body p
		{
			margin: 5px 5px 10px 5px !important;
			width: 99%;
			color: Gray;
		}

	     .x-grid3-col-test {
	        font-family: tahoma, verdana;
			display: block;
			font-weight: normal;
			font-style: normal;
			color: #385F95;
			white-space: normal;
			font-weight:bold;
	    }
	</style>
	    <script type="text/javascript">
	    	var saveData = function () {
	    		GridData.setValue(Ext.encode(GridPanel1.getRowsValues({ selectedOnly: false })));
	    	};
    </script>
	<script type="text/javascript">
		var fullName = function (value, metadata, record, rowIndex, colIndex, store) {
			return record.data.Apellido + ' ' + record.data.Nombre;
		};

		var prepareProfesion = function (value, rec) {
			rec.ProfesionDisplay = value.ProfesionDesc;
		};

	</script>
</head>
<body>
<input id="hiddenCurrentTab"  class="hiddenCurrentTab" runat="server" type="hidden" />

	<div id="dialogContainer">
	</div>
	<uc:Header ID="ucHeader" runat="server"></uc:Header>
	<!-- #header -->
	<uc:NavigationMenu ID="ucNavigationMenu" runat="server"></uc:NavigationMenu>
	<!-- #nav -->
	<div id="container">
		<div class="inner-container">
			<div class="box box-100">
				<form id="Form1" runat="server">
				<div class="box box-100 altbox">
					<div class="boxin">
						<div class="header">
							<h3>
								Contactos</h3>
							<a class="button" href="newContact.aspx">Agregar</a>
							<asp:Button ID="btnEditarContact" runat="server" CssClass="button" Text="Editar" />
							<asp:Button CssClass="button" ID="btnVerContact" runat="server" Text="Ver"/>
							<div id="tabs">
							<ul>
								<li><a id="misContactosLink" class="active misContactosLink" runat="server" href="#" >Mis Contactos</a></li>
								<li><a  id="todosContactosLink" class="todosContactosLink" href="#" runat="server">Todos los Contactos</a></li>
							</ul>
							</div>
						</div>
						<div>
							<ext:ResourceManager ID="ResourceManager1" runat="server" />
							
							<ext:Hidden ID="GridData" runat="server" />
							
							<ext:GridPanel ID="GridPanel1" runat="server" StripeRows="true"
								 TrackMouseOver="true" Width="1000" Height="1000" AutoExpandColumn="ContactoID" AutoHeight="true">
								<Store>
								<ext:Store ID="Store1" runat="server" >
								<Reader>
									<ext:JsonReader IDProperty="ContactoID">
										<Fields>
											<ext:RecordField Name="ContactoID" />
											<ext:RecordField Name="Nombre" />
											<ext:RecordField Name="Apellido" />
											<ext:RecordField Name="LastUpdate" Type="Date" />
											<ext:RecordField Name="Email" />
											<ext:RecordField Name="Celular" />
											<ext:RecordField Name="HasObservacion" />
											<ext:RecordField Name="HasCompromisoAsignado" />
                                            <ext:RecordField Name="FullName" />
										</Fields>
									</ext:JsonReader>
								</Reader>
								<DirectEventConfig IsUpload="true" />
							</ext:Store></Store>
								<ColumnModel ID="ColumnModel1" runat="server">
									<Columns>
										<ext:Column DataIndex="ContactoID" Header="ContactID" Width="100" Hidden="true" />
										<ext:DateColumn DataIndex="LastUpdate" Header="Última actualizacón" Width="130" Format="dd-MM-yyyy G:mm" />
										<%--<ext:Column ColumnID="fullName" Header="Apellido y Nombre" Width="270" DataIndex="LastName">
											<Renderer Fn="fullName" />
										</ext:Column>--%>
                                        <ext:Column ColumnID="test" DataIndex="FullName" Header="Apellidos y Nombres" Width="200" />
										<ext:Column DataIndex="Celular" Header="Celular" Width="150" />
										<ext:Column DataIndex="Email" Header="Correo Electronico" Width="200" />
										<ext:Column DataIndex="HasObservacion" Header="Observaciones" Width="100" />
										<ext:Column DataIndex="HasCompromisoAsignado" Header="Compromisos"
											Width="100" />
									</Columns>
								</ColumnModel>
								<SelectionModel>
									<ext:RowSelectionModel ID="RowSelectionModel1" runat="server">
										<DirectEvents>
											<SelectionChange OnEvent="Cell_Click" />
										</DirectEvents>
									</ext:RowSelectionModel>
								</SelectionModel>
								<TopBar>
									<ext:Toolbar ID="Toolbar1" runat="server">
										<Items>
											<ext:ToolbarFill ID="ToolbarFill1" runat="server" />
											<ext:Button ID="btnToXML" runat="server" Text="To XML" AutoPostBack="true" OnClick="ToXml"
												Icon="PageCode">
												<Listeners>
													<Click Fn="saveData" />
												</Listeners>
											</ext:Button>
											<ext:Button ID="btnToExcel" runat="server" Text="To Excel" AutoPostBack="true" OnClick="ToExcel"
												Icon="PageExcel">
												<Listeners>
													<Click Fn="saveData" />
												</Listeners>
											</ext:Button>
											<ext:Button ID="btnToCSV" runat="server" Text="To CSV" AutoPostBack="true" OnClick="ToCsv"
												Icon="PageAttach">
												<Listeners>
													<Click Fn="saveData" />
												</Listeners>
											</ext:Button>
										</Items>
									</ext:Toolbar>
								</TopBar>
							</ext:GridPanel>
						</div>
					</div>
				</form>
			</div>
		</div>
		<div id="footer">
			<p>
				&copy; CANO Propiedades - 2012, <a href="http://www.canopropiedadespilar.com.ar">CANO
					Propiedades Pilar</a></p>
					
	</div>
	</div>
</body>
	<script type="text/javascript">
		$(document).ready(function () {

//			// Search input text handling on focus
//			var $searchq = $("#search-q").attr("value");
//			$('#search-q.text').css('color', '#999');
//			$('#search-q').focus(function () {
//				if ($(this).attr('value') == $searchq) {
//					$(this).css('color', '#555');
//					$(this).attr('value', '');
//				}
//			});
//			$('#search-q').blur(function () {
//				if ($(this).attr('value') == '') {
//					$(this).attr('value', $searchq);
//					$(this).css('color', '#999');
//				}
//			});
			// Switch categories
			$('#h-wrap').hover(function () {
				$(this).toggleClass('active');
				$("#h-wrap ul").css('display', 'block');
			}, function () {
				$(this).toggleClass('active');
				$("#h-wrap ul").css('display', 'none');
			});
			// Handling with tables (adding first and last classes for borders and adding alternate bgs)
			$('tbody tr:even').addClass('even');
			$('table.grid tbody tr:last-child').addClass('last');
			$('tr th:first-child, tr td:first-child').addClass('first');
			$('tr th:last-child, tr td:last-child').addClass('last');
			$('form.fields fieldset:last-child').addClass('last');
			// Handling with lists (alternate bgs)
			$('ul.simple li:even').addClass('even');
			// Handling with grid views (adding first and last classes for borders and adding alternate bgs)
			$('.grid .line:even').addClass('even');
			$('.grid .line:first-child').addClass('firstline');
			$('.grid .line:last-child').addClass('lastline');
			// Tabs switching
			$('#box1 .content#box1-grid').hide(); // hide content related to inactive tab by default
			$('#box1 .header ul a').click(function () {
				$('#box1 .header ul a').removeClass('active');
				$(this).addClass('active'); // make clicked tab active
				$('#box1 .content').hide(); // hide all content
				$('#box1').find('#' + $(this).attr('rel')).show(); // and show content related to clicked tab
				return false;
			});

			$("#tabs li a").click(function () {
				$("a.active").removeClass("active");
				$(this).addClass("active");
			});

			var currentTab = $(".hiddenCurrentTab").val();
			if (currentTab == "MisContactos") {
				$(".misContactosLink").addClass("active");
				$(".todosContactosLink").removeClass("active");
			}
			else {
				$(".todosContactosLink").addClass("active");
				$(".misContactosLink").removeClass("active");
			}


		});
		</script>
</html>
